home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Imaging / Moire < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.8 KB  |  86 lines  |  [TEXT/ToyS]

  1. on run
  2. end run
  3.  
  4. on idle
  5.     set incr to random number from 2 to 9
  6.     set dims to random number from 200 to 500
  7.     set midP to round (dims / 2)
  8.     
  9.     set drawWin to ¬
  10.         display drawing titled ¬
  11.             "Moire 1.0" with dimensions {dims, dims}
  12.     
  13.     -- Set color
  14.     draw into drawWin ¬
  15.         using state {fg color:"991212"} ¬
  16.         
  17.     -- Across the top
  18.     repeat with x from 0 to dims by incr
  19.         draw a line into drawWin ¬
  20.             inside of {midP, midP, x, 0}
  21.     end repeat
  22.     
  23.     -- Set color, refresh
  24.     draw into drawWin ¬
  25.         using state {fg color:"129912"} ¬
  26.         with refresh
  27.     
  28.     -- Down the right
  29.     repeat with y from 0 to dims by incr
  30.         draw a line into drawWin ¬
  31.             inside of {midP, midP, dims, y}
  32.     end repeat
  33.     
  34.     -- Set color, refresh
  35.     draw into drawWin ¬
  36.         using state {fg color:"121299"} ¬
  37.         with refresh
  38.     
  39.     -- Across the bottom
  40.     repeat with x from dims to 0 by -incr
  41.         draw a line into drawWin ¬
  42.             inside of {midP, midP, x, dims}
  43.     end repeat
  44.     
  45.     -- Set color, refresh
  46.     draw into drawWin ¬
  47.         using state {fg color:"999912"} ¬
  48.         with refresh
  49.     
  50.     -- Down the right
  51.     repeat with y from dims to 0 by -incr
  52.         draw a line into drawWin ¬
  53.             inside of {midP, midP, 0, y}
  54.     end repeat
  55.     
  56.     -- Refresh
  57.     draw into drawWin with refresh
  58.     pause for 3 with seconds timing
  59.     
  60.     -- Quadrants
  61.     set myPic to capture picture from drawWin
  62.     draw a picture into drawWin ¬
  63.         using data myPic ¬
  64.         with scale {-2, -2} ¬
  65.         with a clear slate
  66.     draw a picture into drawWin ¬
  67.         using data myPic ¬
  68.         with scale {-2, -2} ¬
  69.         offset by {midP, 0}
  70.     draw a picture into drawWin ¬
  71.         using data myPic ¬
  72.         with scale {-2, -2} ¬
  73.         offset by {midP, midP}
  74.     draw a picture into drawWin ¬
  75.         using data myPic ¬
  76.         with scale {-2, -2} ¬
  77.         offset by {0, midP}
  78.     
  79.     draw into drawWin with refresh
  80.     pause for 3 with seconds timing
  81.     
  82.     display drawing drawWin with disposal
  83.     
  84.     return 5
  85. end idle
  86.